//import Cookies from 'js-cookie'
const lConfig = JSON.parse(import.meta.env.VITE_APP_LOGIN_CONFIG);

const TokenKey = lConfig.tokenKey;
const usernameKey=lConfig.runameKey;
const passwordKey=lConfig.rpwdKey;
const rememberMeKey=lConfig.rmeKey;

export function getToken() {
  //return Cookies.get(TokenKey)
  return localStorage.getItem(TokenKey)
}

export function setToken(token,cparam) {
  //return Cookies.set(TokenKey, token,cparam)
  localStorage.setItem(TokenKey, token)
}

export function removeToken() {
  //return Cookies.remove(TokenKey)
  localStorage.removeItem(TokenKey)
}

export function getLoginStore(){
  return {
    username: localStorage.getItem(usernameKey),
    password: localStorage.getItem(passwordKey),
    rememberMe: localStorage.getItem(rememberMeKey)
  }
}

export function setLoginStore(username,password,rememberMe){
  localStorage.setItem(usernameKey,username);
  localStorage.setItem(passwordKey,password);
  localStorage.setItem(rememberMeKey,rememberMe);
}

export function removeLoginStore(){
  localStorage.removeItem(usernameKey);
  localStorage.removeItem(passwordKey);
  localStorage.removeItem(rememberMeKey);
}
